﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.WindowsAzure;
using System.Configuration;

namespace AzureGames.Data.Implementation.Tests
{
    [TestClass]
    public class NotificationRepositoryTests
    {
        /// <summary>
        ///A test for CreateTopic
        ///</summary>
        [TestMethod]
        public void CreateTopicTest()
        {
            PrivateObject accessor = new PrivateObject(new NotificationRepository());

            accessor.Invoke("CreateTopic", new Object[] { "BroadcastTopic"});

           
        }

        [TestMethod]
        public void CreateSubscriptionTest()
        {
            NotificationRepository rep = new NotificationRepository();
            PrivateObject accessor = new PrivateObject(new NotificationRepository());

            accessor.Invoke("CreateSubscription", new Object[] { "BroadcastTopic", Guid.Empty.ToString() });
        }

        [TestMethod]
        public void PostNotification()
        {
            NotificationRepository rep = new NotificationRepository();
            rep.PostNotification(new Model.Notification { Message = "My message today is this" });
        }

        [TestMethod]
        public void PushNotifications()
        {
            NotificationRepository rep = new NotificationRepository();
            rep.NotifyEvent += new NotifyEventHandler(rep_NotifyEvent);
            rep.PushNotifications(Guid.Empty.ToString());
            rep.PostNotification(new Model.Notification { Message = "My message today is this" });

            
        }

        bool rep_NotifyEvent(INotificationRepository sender, NotifyEventArgs args)
        {
            return true;
        }
    }
}
